<?php
include "KeyWorker.php";
use Cn\Ubingo\Security\RSA\Core as core;
use Cn\Ubingo\Security\RSA\Data as data;

function encryptData($params,$privateKey)
{
  ksort($params);
  $privateWorker = new data\KeyWorker($privateKey ,core\KeyFormat::ASN);
  $data = $privateWorker->encrypt(json_encode($params));
  return $data;
}

function decryptData($params,$publicKey)
{
  $publicWorker = new data\KeyWorker($publicKey ,core\KeyFormat::ASN);
  $data = $publicWorker->decrypt($params);
  return $data;
}

?>